package JUC.多线程;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author CKC
 * @date 2022/11/23 15:29
 */
public class ThreadPoolDemo {
    public static void demo1() {
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(
                1,
                2,
                10,
                TimeUnit.SECONDS,
                new LinkedBlockingDeque<>(2),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.CallerRunsPolicy());

        threadPool.execute(()-> System.out.println("12345"));

    }
}
